<?php include TMPL_PATH.'public/header.phtml';?>
<link rel="stylesheet" type="text/css" href="/statics/js/calendar/jscal2.css"/>
<link rel="stylesheet" type="text/css" href="/statics/js/calendar/border-radius.css"/>
<link rel="stylesheet" type="text/css" href="/statics/js/calendar/win2k.css"/>
<script type="text/javascript" src="/statics/js/calendar/calendar.js"></script>
<script type="text/javascript" src="/statics/js/calendar/lang/zh-cn.js"></script>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
    	<div style="float:left;margin-right:50px;">
        <a href='javascript:;' class="on"><em>退款列表</em></a>
      </div>
    	<div style="color:#000;">
    		<form name="searchform" action="__SELF__"  method="post">
    		订单号：<input type="text" class="input-text"  name="order_sn" value="<?php echo $order_sn ?>"/>
    		状态：<select name="status" id="status"><option value=''>≡ 全部  ≡</option>
				<option value='99' <?php  echo ($status==99)? 'selected' : ''; ?>>未处理</option>
				<option value='1' <?php  echo ($status==1)? 'selected' : ''; ?>>审核通过</option>
				<option value='2' <?php  echo ($status==2)? 'selected' : ''; ?>>退款完成</option>
                <option value='3' <?php  echo ($status==3)? 'selected' : ''; ?>>已拒绝</option>
				</select>
    		申请类型：<select name="apply_type" id="apply_type">
                <option value='' selected="selected">≡ 全部  ≡</option>
				<option value='99' <?php  echo ($apply_type==99)? 'selected' : ''; ?>>退款</option>
				<option value='1' <?php  echo ($apply_type==1)? 'selected' : ''; ?>>重做</option>
				</select>                
                申请时间：
            <input class="input-text" name="add_start_time" type="text" id="add_start_time" size="22" value='<?php echo $add_start_time;?>'/>
                <script type="text/javascript">
                    Calendar.setup({
                    weekNumbers: false,
                    inputField : "add_start_time",
                    trigger    : "add_start_time",
                    dateFormat: "%Y-%m-%d",
                    showTime: false,
                    minuteStep: 1,
                    onSelect   : function() {this.hide();}
                    });
                </script> - &nbsp;
                <input class="input-text"  name="add_end_time" type="text" id="add_end_time" size="22" value='<?php echo $add_end_time;?>'/>
                <script type="text/javascript">
                    Calendar.setup({
                    weekNumbers: false,
                    inputField : "add_end_time",
                    trigger    : "add_end_time",
                    dateFormat: "%Y-%m-%d",
                    showTime: false,
                    minuteStep: 1,
                    onSelect   : function() {this.hide();}
                    });
                </script>             
                最后审核时间：
               <input class="input-text" name="end_start_time" type="text" id="end_start_time" size="22" value='<?php echo $end_start_time;?>'/>
                <script type="text/javascript">
                    Calendar.setup({
                    weekNumbers: false,
                    inputField : "end_start_time",
                    trigger    : "end_start_time",
                    dateFormat: "%Y-%m-%d",
                    showTime: false,
                    minuteStep: 1,
                    onSelect   : function() {this.hide();}
                    });
                </script> - &nbsp;
                <input class="input-text"  name="end_end_time" type="text" id="end_end_time" size="22" value='<?php echo $end_end_time;?>'/>
                <script type="text/javascript">
                    Calendar.setup({
                    weekNumbers: false,
                    inputField : "end_end_time",
                    trigger    : "end_end_time",
                    dateFormat: "%Y-%m-%d",
                    showTime: false,
                    minuteStep: 1,
                    onSelect   : function() {this.hide();}
                    });
                </script>                  
                
				<input type="submit" value="搜索" class="button" name="search">
    		</form>       
        </div>       
    </div>
    <div style="float:right;">
         <a href="javascript:returnExcel();">导出Excel</a>
    </div>      
</div>
<div class="bk"></div>
<div class="pad_10">
<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <th align='center' width="100">订单号</th>
            <th align='center' width="100">收款人</th>
            <th align='center' width="100">申请类型</th>
            <th align='center' width="100">申请金额</th>
            <th align='center' width="100">退款金额</th>
            <th align='center' width="100">状态</th>
            <th align='center' width="100">申请人</th>
            <th align='center' width="100">申请时间</th>
            <th align='center' width="100">审核人</th>
            <th align='center' width="100">审核时间</th>
			<th width="80">管理操作</th>
            </tr>
        </thead>
    <tbody>
    <?php
   	if(isset($returnList) && $returnList):
   		foreach ($returnList as $v):
   ?>
			<tr>
				<td align='center'><a href="<?php echo U('order/order_edit','oid='.$v['order_id'])?>"><?php echo $v['order_sn'];?></a></td>
					<td align='center'><?php echo $v['user_name']?></td>
                    <td align='center'><?php echo $v['apply_type'] == 1 ? '重做' : '退款';?></td>
                    <td align='center'><?php echo $v['apply_amount']?></td>
					<td align='center'><?php echo $v['return_amount']?></td>
					<td align='center'>
					<?php
					    if($v['status']==3){
						    echo "已拒绝";
						}elseif($v['status']==2){
						    echo $v['apply_type'] == 1 ? '重做' : '退款';echo "完成";
						}elseif($v['status']==1){
						    echo "审核通过";
						}elseif($v['status']==0){
						    echo "未处理";
						}
					?>
                    </td>
					<td align='center'><?php echo $v['admin_user']?></td>
					<td align='center'><?php echo $v['add_time'] ? date('Y-m-d H:i:s', $v['add_time']) : '';?></td>
					<td align='center'><?php echo $v['check_user']?></td>
                    <td align='center'> <?php echo $v['end_time'] ? date('Y-m-d H:i:s', $v['end_time']) : '';?></td>
                    <td align='center'> 
					<a href="<?php echo U('order/pay_return_edit', array('pid'=>$v['id']));?>">查看</a>
<!--					 | <a href="javascript:confirmurl('<?php echo U('order/order_delete', 'oid='.$v['id']);?>','确认要删除 『<?php echo $v['name']?>』 吗？')">删除</a>-->
					</td>
				</tr>
	<?php 
		endforeach;
		endif;
	?>
   </tbody>
    </table>
<div id="pages"><?php echo $pageShow;?></div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
function returnExcel(){
    var hrefstr ="<?php echo U('order/pay_return_list');?>"
                     +"&doexcel=1"
                     +"&order_sn="+$('input[name="order_sn"]').val()
                     +"&status="+$('#status').val()
					 +"&apply_type="+$('#apply_type').val()
                     +"&add_start_time="+$('#add_start_time').val()
                     +"&add_end_time="+$('#add_end_time').val()
                     +"&end_start_time="+$('#end_start_time').val()
                     +"&end_end_time="+$('#end_end_time').val();
    location.href = hrefstr;
}
</script>